/*
EP3D is a real-time 3D planet engine , which in addition to providing 
substandard scene rendering and scene management, of course, it also 
provides some basic class libraries to build the entire virtual 
planet, or even the entire universe.

Copyright (C) 2010  Hongjiang Zhang	(zhjwyat@gmail.com)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef EP3D_ATTRIBUTES_H
#define EP3D_ATTRIBUTES_H
#include "EP3DAttribute.h"

namespace EP3D
{
	class XMLWriter;
	class EP3DEXPORT Attributes
	{
	public:
		Attributes(void);
		virtual ~Attributes(void);

		virtual uint GetAttributeCount() const;
		virtual AttributeType GetAttributeType(const TCHAR* name);
		virtual const TCHAR* GetAttributeTypeString(const TCHAR* name);
		virtual bool IsExistAttribute(const TCHAR* name);
		virtual void Clear();
		virtual bool Write(XMLWriter* pkWriter, bool bWriteHeader, const wchar_t* elementname);

		virtual void AddInt(const TCHAR* name, int val);
		virtual void AddF32(const TCHAR* name, f32 val);
		virtual void AddF64(const TCHAR* name, f64 val);
		virtual void AddBool(const TCHAR* name, bool val);
		virtual void AddString(const TCHAR* name, const TCHAR* val);
		virtual void AddStringArray(const TCHAR* name, const StringArray& val);
		virtual void AddEnum(const TCHAR* name, const TCHAR* val, const TCHAR* const* literals);
		virtual void AddEnum(const TCHAR* name, int val, const TCHAR* const* literals);

		virtual void SetAttribute(const TCHAR* name, int val);
		virtual void SetAttribute(const TCHAR* name, f32 val);
		virtual void SetAttribute(const TCHAR* name, f64 val);
		virtual void SetAttribute(const TCHAR* name, bool val);
		virtual void SetAttribute(const TCHAR* name, const TCHAR* val);
		virtual void SetAttribute(const TCHAR* name, const StringArray& val);
		virtual void SetAttribute(const TCHAR* name, const TCHAR* val, const TCHAR* const* literals);

		virtual int GetAttributeAsInt(const TCHAR* name);
		virtual f32 GetAttributeAsF32(const TCHAR* name);
		virtual f64 GetAttributeAsF64(const TCHAR* name);
		virtual bool GetAttributeAsBool(const TCHAR* name);
		virtual String GetAttributeAsString(const TCHAR* name);
		virtual StringArray GetAttributeAsStringArray(const TCHAR* name);
		virtual const TCHAR* GetAttributeAsEnumeration(const TCHAR* name);

	protected:
		AttributePtr GetAttributeByName(const TCHAR* name);

		Array<AttributePtr> m_akAttributes;
	};
}

#endif
